import axios from "axios";

//声明axios实例
const instance = axios.create({
  headers: {
    "Content-Type": "application/json",
  },
  timeout: 3000,
});

//请求拦截:发送请求之前拦截
instance.interceptors.request.use(
    config => {
    return config
},
    error=>{
    return Promise.reject(error)
});

//响应拦截
instance.interceptors.response.use(
    res=>{
        return res
    },

    error=>{
        return Promise.reject(error)
    }
);

export default instance;
